home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.compuserve.com!newsmaster
  2. From: <.,@compuserve.com>
  3. Newsgroups: comp.lang.c++,comp.object,comp.object.logic
  4. Subject: polymorphism
  5. Date: 24 Mar 1996 04:46:03 GMT
  6. Organization: CompuServe Incorporated
  7. Message-ID: <4j2k2b$4pj@arl-news-svc-3.compuserve.com>
  8. NNTP-Posting-Host: ad28-178.compuserve.com
  9. Content-Type: text/plain
  10. Content-length: 629
  11. X-Newsreader: AIR Mosaic (16-bit) version 4.00.08.32
  12.  
  13.  
  14.  >>What is polymorphism.
  15.  
  16.   The usual example is a shape object.
  17.  Shape is your base class.
  18.   From this you derive the classes called Circle, Triangle, and Square.
  19. Shape has a function called Draw()
  20. So each of the 3 classes (Circle, Triangle, Square) redo the Draw() function
  21. in there own way.  Thus they all will be drawn differently from the others.
  22.   The compiler can handle this.  The classes are said to be able
  23. to draw themselves.  
  24.   Note the Draw() must be identicle to the Shape classes Draw().
  25.   You can't change the argument list, this would be an overloaded
  26. function and would not be the same function.
  27.  
  28.